package indexer;

public class CrawlingManager {
	public static volatile boolean ShouldStopThreads = false;
	public static volatile int WaitingThreadsCount = 0;

	private Spider[] spiderArray;

	// / <summary>
	// / Declaring the Event Handler delegate
	// / </summary>
	// public delegate void CrawlerEventHandler(Report.ProgressEventArgs pea);
	// public static event CrawlerEventHandler CrawlerEvent;

	public CrawlingManager() {

	}

	// / <summary>
	// / Number of spider threads to start
	// / </summary>
	// / <param name="p"></param>
	public void StartSpider() {
		SeedList.GetTheList();

		spiderArray = new Spider[Common.ThreadsCount];

		for (int i = 0; i < Common.ThreadsCount; i++) {
			spiderArray[i] = new Spider(i);
		}
	}

	public void StopSpiders() {
		for (int i = 0; i < Common.ThreadsCount; i++) {
			spiderArray[i].stopSpider();
		}
	}
}